const express = require('express');
const controler = require('../controller/dbServe.js');
const router = express.Router();

router.get('/test', (req, res) => {
    res.type('html');
    res.render('test.html');
});
//新建wall数据
router.post('/insertwall',(req,res)=>{
    controler.insertWall(req,res);
});

//新建反馈
router.post('/insertfeedback',(req,res)=>{
    controler.insertFeedback(req,res);
});

//新建评论
router.post('/insertcomment',(req,res)=>{
    controler.insertComment(req,res);
});

//删除墙，连带删除子评论
router.post('/deletewall',(req,res)=>{
    controler.deleteWall(req,res); 
})

//删除反馈
router.post('/deletefeedback',(req,res)=>{
    controler.deleteFeedback(req,res);
})

//删除评论
router.post('/deletecomment',(req,res)=>{
    controler.deleteComment(req,res);
})

//分页查询墙
router.post('/findwallpage',(req,res)=>{
    console.log(req.body);
    controler.findWallPage(req,res);
})
//分页查询墙评论
router.post('/findcommentpage',(req,res)=>{
    controler.findCommentPage(req,res); 
})

//用户进入进行ip登记
router.post('/signip',(req,res)=>{
    const ip =req.ip;
    // console.log(ip);
    res.send({
        code:200,
        ip:ip,
    });
})
module.exports = router;